<?php



use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateSeecmsAttachmentTable extends Migration
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * 以下命令可以在此方法中使用，Phinx 将在回滚时自动反转它们:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * 如果希望实现自动升级降级，那就把逻辑写在change方法里，只最终调用create和update方法，不要调用save方法
     *
     * 创建使用 create()、更新使用 update()
     */

    protected $name = 'seecms_attachment';

    public function up()
    {
        Schema::create($this->name, function (Blueprint $table) {
            $table->id();
            $table->integer('user_id');
            $table->string('filename')->comment('文件名称');
            $table->string('filepath')->comment('保存路径');
            $table->string('thumb')->comment('缩略图');
            $table->string('mime')->comment('文件mime类型');
            $table->string('ext')->comment('文件扩展类型');
            $table->string('size')->comment('文件大小');
            $table->string('md5')->comment('md5类型hash散列值');
            $table->string('sha1')->comment('sha1类型hash散列值');
            $table->string('driver')->comment('储存引擎')->default('local');
            $table->timestamps();
        });
    }

    public function down()
    {
        Schema::dropIfExists($this->name);
    }
}
